﻿using MaiPlanServer.IServices.IOrganizationaServices;
using MaiPlanServer.Utility;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace MaiPlanServer.API.Controllers.Organizational
{
    [Route("api/[controller]")]
    [ApiController]
    public class RoleManageController : ControllerBase
    {
        public RoleManageController(IRoleManageServices db)
        {
            Db = db;
        }

        public IRoleManageServices Db { get; }
        [HttpGet]
        public async Task<IActionResult> Get()
        {
            try
            {
                var list = await Db.GetRole();
                return Ok(BaseState.CreateInstance(200, "请求成功", list));
            }
            catch (System.Exception ex)
            {
                //后续写日志
            }
            return Ok(BaseState.CreateInstance(-1, "请求失败，服务器异常"));
        }
    }
}
